home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / lib / gcc-lib / i486-unknown-sco3.2v5.0.0elf / 2.6-95q2 / include / stddef.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-07-12  |  8.3 KB  |  300 lines

  1. #ifndef _STDDEF_H
  2. #ifndef _STDDEF_H_
  3. #ifndef _ANSI_STDDEF_H
  4. #ifndef __STDDEF_H__
  5.  
  6. /* Any one of these symbols __need_* means that GNU libc
  7.    wants us just to define one data type.  So don't define
  8.    the symbols that indicate this file's entire job has been done.  */
  9. #if (!defined(__need_wchar_t) && !defined(__need_size_t)    \
  10.      && !defined(__need_ptrdiff_t) && !defined(__need_NULL))
  11. #define _STDDEF_H
  12. #define _STDDEF_H_
  13. /* snaroff@next.com says the NeXT needs this.  */
  14. #define _ANSI_STDDEF_H
  15. /* Irix 5.1 needs this.  */
  16. #define __STDDEF_H__
  17. #endif
  18.  
  19. #ifndef __sys_stdtypes_h
  20. /* This avoids lossage on SunOS but only if stdtypes.h comes first.
  21.    There's no way to win with the other order!  Sun lossage.  */
  22.  
  23. /* On 4.3bsd-net2, make sure ansi.h is included, so we have
  24.    one less case to deal with in the following.  */
  25. #if defined (__BSD_NET2__) || defined (____386BSD____) || defined (__FreeBSD__) || defined(__NetBSD__)
  26. #include <machine/ansi.h>
  27. #endif
  28.  
  29. /* In 4.3bsd-net2, machine/ansi.h defines these symbols, which are
  30.     defined if the corresponding type is *not* defined.  */
  31. #ifdef _ANSI_H_
  32. #if !defined(_SIZE_T_) && !defined(_BSD_SIZE_T_)
  33. #define _SIZE_T
  34. #endif
  35. #if !defined(_PTRDIFF_T_) && !defined(_BSD_PTRDIFF_T_)
  36. #define _PTRDIFF_T
  37. #endif
  38. /* On BSD/386 1.1, at least, machine/ansi.h defines _BSD_WCHAR_T_
  39.    instead of _WCHAR_T_. */
  40. #if !defined(_WCHAR_T_) && !defined(_BSD_WCHAR_T_)
  41. #ifndef _BSD_WCHAR_T_
  42. #define _WCHAR_T
  43. #endif
  44. #endif
  45. /* Undef _FOO_T_ if we are supposed to define foo_t.  */
  46. #if defined (__need_ptrdiff_t) || defined (_STDDEF_H_)
  47. #undef _PTRDIFF_T_
  48. #undef _BSD_PTRDIFF_T_
  49. #endif
  50. #if defined (__need_size_t) || defined (_STDDEF_H_)
  51. #undef _SIZE_T_
  52. #undef _BSD_SIZE_T_
  53. #endif
  54. #if defined (__need_wchar_t) || defined (_STDDEF_H_)
  55. #undef _WCHAR_T_
  56. #undef _BSD_WCHAR_T_
  57. #endif
  58. #endif /* _ANSI_H_ */
  59.  
  60. /* Sequent's header files use _PTRDIFF_T_ in some conflicting way.
  61.    Just ignore it.  */
  62. #if defined (__sequent__) && defined (_PTRDIFF_T_)
  63. #undef _PTRDIFF_T_
  64. #endif
  65.  
  66. /* On VxWorks, <type/vxTypesBase.h> may have defined macros like
  67.    _TYPE_size_t which will typedef size_t.  fixincludes patched the
  68.    vxTypesBase.h so that this macro is only defined if _GCC_SIZE_T is
  69.    not defined, and so that defining this macro defines _GCC_SIZE_T.
  70.    If we find that the macros are still defined at this point, we must
  71.    invoke them so that the type is defined as expected.  */
  72. #if defined (TYPE_ptrdiff_t) && (defined (__need_ptrdiff_t) || defined (_STDDEF_H_))
  73. _TYPE_ptrdiff_t;
  74. #undef _TYPE_ptrdiff_t
  75. #endif
  76. #if defined (_TYPE_size_t) && (defined (__need_size_t) || defined (_STDDEF_H_))
  77. _TYPE_size_t;
  78. #undef _TYPE_size_t
  79. #endif
  80. #if defined (_TYPE_wchar_t) && (defined (__need_wchar_t) || defined (_STDDEF_H_))
  81. _TYPE_wchar_t;
  82. #undef _TYPE_wchar_t
  83. #endif
  84.  
  85. /* In case nobody has defined these types, but we aren't running under
  86.    GCC 2.00, make sure that __PTRDIFF_TYPE__, __SIZE__TYPE__, and
  87.    __WCHAR_TYPE__ have reasonable values.  This can happen if the
  88.    parts of GCC is compiled by an older compiler, that actually
  89.    include gstddef.h, such as collect2.  */
  90.  
  91. /* Signed type of difference of two pointers.  */
  92.  
  93. /* Define this type if we are doing the whole job,
  94.    or if we want this type in particular.  */
  95. #if defined (_STDDEF_H) || defined (__need_ptrdiff_t)
  96. #ifndef _PTRDIFF_T    /* in case <sys/types.h> has defined it. */
  97. #ifndef _T_PTRDIFF_
  98. #ifndef _T_PTRDIFF
  99. #ifndef __PTRDIFF_T
  100. #ifndef _PTRDIFF_T_
  101. #ifndef _BSD_PTRDIFF_T_
  102. #ifndef ___int_ptrdiff_t_h
  103. #ifndef _GCC_PTRDIFF_T
  104. #define _PTRDIFF_T
  105. #define _T_PTRDIFF_
  106. #define _T_PTRDIFF
  107. #define __PTRDIFF_T
  108. #define _PTRDIFF_T_
  109. #define _BSD_PTRDIFF_T_
  110. #define ___int_ptrdiff_t_h
  111. #define _GCC_PTRDIFF_T
  112. #ifndef __PTRDIFF_TYPE__
  113. #define __PTRDIFF_TYPE__ long int
  114. #endif
  115. typedef __PTRDIFF_TYPE__ ptrdiff_t;
  116. #endif /* _GCC_PTRDIFF_T */
  117. #endif /* ___int_ptrdiff_t_h */
  118. #endif /* _BSD_PTRDIFF_T_ */
  119. #endif /* _PTRDIFF_T_ */
  120. #endif /* __PTRDIFF_T */
  121. #endif /* _T_PTRDIFF */
  122. #endif /* _T_PTRDIFF_ */
  123. #endif /* _PTRDIFF_T */
  124.  
  125. /* If this symbol has done its job, get rid of it.  */
  126. #undef    __need_ptrdiff_t
  127.  
  128. #endif /* _STDDEF_H or __need_ptrdiff_t.  */
  129.  
  130. /* Unsigned type of `sizeof' something.  */
  131.  
  132. /* Define this type if we are doing the whole job,
  133.    or if we want this type in particular.  */
  134. #if defined (_STDDEF_H) || defined (__need_size_t)
  135. #ifndef _SIZE_T    /* in case <sys/types.h> has defined it. */
  136. #ifndef _SYS_SIZE_T_H
  137. #ifndef _T_SIZE_
  138. #ifndef _T_SIZE
  139. #ifndef __SIZE_T
  140. #ifndef _SIZE_T_
  141. #ifndef _BSD_SIZE_T_
  142. #ifndef _SIZE_T_DEFINED_
  143. #ifndef ___int_size_t_h
  144. #ifndef _GCC_SIZE_T
  145. #ifndef _SIZET_
  146. #ifndef __size_t
  147. #define _SIZE_T
  148. #define _SYS_SIZE_T_H
  149. #define _T_SIZE_
  150. #define _T_SIZE
  151. #define __SIZE_T
  152. #define _SIZE_T_
  153. #define _BSD_SIZE_T_
  154. #define _SIZE_T_DEFINED_
  155. #define ___int_size_t_h
  156. #define _GCC_SIZE_T
  157. #define _SIZET_
  158. #define __size_t
  159. #ifndef __SIZE_TYPE__
  160. #define __SIZE_TYPE__ long unsigned int
  161. #endif
  162. #if !(defined (__GNUG__) && defined (size_t))
  163. typedef __SIZE_TYPE__ size_t;
  164. #endif /* !(defined (__GNUG__) && defined (size_t)) */
  165. #endif /* __size_t */
  166. #endif /* _SIZET_ */
  167. #endif /* _GCC_SIZE_T */
  168. #endif /* ___int_size_t_h */
  169. #endif /* _SIZE_T_DEFINED_ */
  170. #endif /* _BSD_SIZE_T_ */
  171. #endif /* _SIZE_T_ */
  172. #endif /* __SIZE_T */
  173. #endif /* _T_SIZE */
  174. #endif /* _T_SIZE_ */
  175. #endif /* _SYS_SIZE_T_H */
  176. #endif /* _SIZE_T */
  177. #undef    __need_size_t
  178. #endif /* _STDDEF_H or __need_size_t.  */
  179.  
  180.  
  181. /* Wide character type.
  182.    Locale-writers should change this as necessary to
  183.    be big enough to hold unique values not between 0 and 127,
  184.    and not (wchar_t) -1, for each defined multibyte character.  */
  185.  
  186. /* Define this type if we are doing the whole job,
  187.    or if we want this type in particular.  */
  188. #if defined (_STDDEF_H) || defined (__need_wchar_t)
  189. #ifndef _WCHAR_T
  190. #ifndef _T_WCHAR_
  191. #ifndef _T_WCHAR
  192. #ifndef __WCHAR_T
  193. #ifndef _WCHAR_T_
  194. #ifndef _BSD_WCHAR_T_
  195. #ifndef _WCHAR_T_DEFINED_
  196. #ifndef _WCHAR_T_H
  197. #ifndef ___int_wchar_t_h
  198. #ifndef __INT_WCHAR_T_H
  199. #ifndef _GCC_WCHAR_T
  200. #define _WCHAR_T
  201. #define _T_WCHAR_
  202. #define _T_WCHAR
  203. #define __WCHAR_T
  204. #define _WCHAR_T_
  205. #define _BSD_WCHAR_T_
  206. #define _WCHAR_T_DEFINED_
  207. #define _WCHAR_T_H
  208. #define ___int_wchar_t_h
  209. #define __INT_WCHAR_T_H
  210. #define _GCC_WCHAR_T
  211.  
  212. /* On BSD/386 1.1, at least, machine/ansi.h defines _BSD_WCHAR_T_
  213.    instead of _WCHAR_T_, and _BSD_RUNE_T_ (which, unlike the other
  214.    symbols in the _FOO_T_ family, stays defined even after its
  215.    corresponding type is defined).  If we define wchar_t, then we
  216.    must undef _WCHAR_T_; for BSD/386 1.1 (and perhaps others), if
  217.    we undef _WCHAR_T_, then we must also define rune_t, since 
  218.    headers like runetype.h assume that if machine/ansi.h is included,
  219.    and _BSD_WCHAR_T_ is not defined, then rune_t is available.
  220.    machine/ansi.h says, "Note that _WCHAR_T_ and _RUNE_T_ must be of
  221.    the same type." */
  222. #ifdef _BSD_WCHAR_T_
  223. #undef _BSD_WCHAR_T_
  224. #ifdef _BSD_RUNE_T_
  225. #if !defined (_ANSI_SOURCE) && !defined (_POSIX_SOURCE)
  226. typedef _BSD_RUNE_T_ rune_t;
  227. #endif
  228. #endif
  229. #endif
  230.  
  231. #ifndef __WCHAR_TYPE__
  232. #define __WCHAR_TYPE__ int
  233. #endif
  234. typedef __WCHAR_TYPE__ wchar_t;
  235. #endif
  236. #endif
  237. #endif
  238. #endif
  239. #endif
  240. #endif
  241. #endif
  242. #endif
  243. #endif
  244. #endif
  245. #endif
  246. #undef    __need_wchar_t
  247. #endif /* _STDDEF_H or __need_wchar_t.  */
  248.  
  249. /*  In 4.3bsd-net2, leave these undefined to indicate that size_t, etc.
  250.     are already defined.  */
  251. #ifdef _ANSI_H_
  252. /*  The references to _GCC_PTRDIFF_T_, _GCC_SIZE_T_, and _GCC_WCHAR_T_
  253.     are probably typos and should be removed before 2.7 is released.  */
  254. #ifdef _GCC_PTRDIFF_T_
  255. #undef _PTRDIFF_T_
  256. #undef _BSD_PTRDIFF_T_
  257. #endif
  258. #ifdef _GCC_SIZE_T_
  259. #undef _SIZE_T_
  260. #undef _BSD_SIZE_T_
  261. #endif
  262. #ifdef _GCC_WCHAR_T_
  263. #undef _WCHAR_T_
  264. #undef _BSD_WCHAR_T_
  265. #endif
  266. /*  The following ones are the real ones.  */
  267. #ifdef _GCC_PTRDIFF_T
  268. #undef _PTRDIFF_T_
  269. #endif
  270. #ifdef _GCC_SIZE_T
  271. #undef _SIZE_T_
  272. #endif
  273. #ifdef _GCC_WCHAR_T
  274. #undef _WCHAR_T_
  275. #endif
  276. #endif /* _ANSI_H_ */
  277.  
  278. #endif /* __sys_stdtypes_h */
  279.  
  280. /* A null pointer constant.  */
  281.  
  282. #if defined (_STDDEF_H) || defined (__need_NULL)
  283. #undef NULL        /* in case <stdio.h> has defined it. */
  284. #define NULL ((void *)0)
  285. #endif    /* NULL not defined and <stddef.h> or need NULL.  */
  286. #undef    __need_NULL
  287.  
  288. #ifdef _STDDEF_H
  289.  
  290. /* Offset of member MEMBER in a struct of type TYPE.  */
  291.  
  292. #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
  293.  
  294. #endif /* _STDDEF_H was defined this time */
  295.  
  296. #endif /* __STDDEF_H__ was not defined before */
  297. #endif /* _ANSI_STDDEF_H was not defined before */
  298. #endif /* _STDDEF_H_ was not defined before */
  299. #endif /* _STDDEF_H was not defined before */
  300.